import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import request from './utils/request'
import storage from './utils/storage'
import api from './api'

console.log("环境变量=》", import.meta.env)

const app = createApp(App);

app.directive('has',{
    beforeMount:(el,binding)=>{
        // console.log(el,binding)
        let prems = storage.getItem("userInfo").moduleCodes;
        let value = binding.value;
        if (!prems.includes(value)) {
            el.style = "display:none";
            setTimeout(() => {
                el.parentNode.removeChild(el);
            });
        }
    }
})

app.config.globalProperties.$request = request;
app.config.globalProperties.$storage = storage;
app.config.globalProperties.$api = api;
app.use(router).use(store).use(ElementPlus,{ size: 'small'}).mount('#app')
